// pages/goods/goods.js

Component({
properties:{},
  
      data: {
        selected: 0,
        tabList: [
          {
            "pagePath": "pages/index1/index1",
            "text": "首页"
            
          },
          {
            "pagePath": "pages/myClass/myClass",
            "text": "教程"
            
          },
          {
            "pagePath": "pages/social/social",
            "text": "S圈"
          },
          {
            "pagePath": "pages/tool/tool",
            "text": "小工具"
          },
          {
            "pagePath": "pages/my/my",
            "text": "我的"
          }
        ]
            
      },

 
     methods: {
      //底部切换
      switchTab(e) {
        let key = Number(e.currentTarget.dataset.index);
        let tabList = this.data.tabList;
        let selected= this.data.selected;
        
        if(selected !== key){
          this.setData({
            selected:key
          });
          wx.switchTab({
            url: `/${tabList[key].pagePath}`,
           
          })
        }
      },
    }
  
   
})